/* Layout */
import Layout from '@/framework/layout'

export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/framework/views/login/index'),
    // component: () => import('@/views/homePage/index'),

    hidden: true
  },
  // {
  //   path: '/flowDetail',
  //   component: () => import('@/framework/views/workflow/flowDetail/index.vue'),
  //   hidden: true,
  //   meta: {
  //     appCode: 'flowwork'
  //   }
  // },
  // {
  //   path: '/design',
  //   component: () => import('@/framework/views/workflow/flowManage/flowFormDesign/build/index.vue'),
  //   // component: () => import('@/framework/views/login/login'),
  //   hidden: true
  // },
  {
    path: '/',
    component: () => import('@/framework/views/workbench/gridLayout/index'),
    hidden: true
  },
  // 测试
  {
    path: '/mall/refund',
    component: () => import('@/views/mall/refund/index.vue'),
    hidden: true
  },

  {
    path: '/customIndex',
    component: () =>
      import('@/framework/views/workbench/gridLayout/customIndex'),
    hidden: true
  },
  {
    path: '/newForgetPw',
    component: () => import('@/framework/views/login/newForgetPw'),
    hidden: true
  },
  {
    path: '/classroomLogin',
    component: () => import('@/framework/views/login/classroomLogin'),
    hidden: true
  },
  {
    path: '/classroomRegister',
    component: () => import('@/framework/views/login/classroomRegister'),
    hidden: true
  },
  {
    path: '/forceUpdatePw',
    component: () => import('@/framework/views/system/user/forceUpdatePw'),
    hidden: true
  },
  {
    path: '/authentication',
    component: () => import('@/framework/views/login/authentication'),
    hidden: true
  },
  {
    path: '/logout',
    component: () => import('@/framework/views/login/logout'),
    hidden: true
  },
  // 锁屏
  {
    path: '/lock',
    hidden: true,
    name: '锁屏页',
    component: () => import('@/framework/views/dashboard/lock')
  },
  {
    path: '/dash',
    component: Layout,
    redirect: '/dashboard',
    children: [
      // export const asyncRoutes = [];

      // 即时通讯
      // {
      //   path: '/instantMessaging',
      //   component: Layout,
      //   hidden: false,
      //   alwaysShow: false,
      //   children:[
      //     {
      //       path: '',
      //       name: 'InstantMessaging',
      //       component: () => import('@/views/instantMessaging/index'),
      //       meta: { title: '即时通讯', icon: 'dashboard',hidden:false }
      //     }
      //   ]
      // },
      // 即时通讯移动端
      //   {
      //     path: '/instantMessagingPhone',
      //     component: () => import('@/views/instantMessaging/phone'),
      //     hidden: true
      //   },
      // ]
      {
        path: '/dashboard',
        component: () => import('@/framework/views/dashboard/index'),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'dashboard', affix: false }
      },
      {
        path: '/user/personalCenter',
        component: () =>
          import('@/framework/views/system/user/newPersonalCenter'),
        name: 'personalCenter',
        meta: { title: '个人中心', icon: 'dashboard' }
      }
    ]
  },
  // 即时通讯
  // {
  //   path: '/instantMessaging',
  //   component: Layout,
  //   hidden: false,
  //   alwaysShow: false,
  //   children:[
  //     {
  //       path: '',
  //       name: 'InstantMessaging',
  //       component: () => import('@/views/instantMessaging/index'),
  //       meta: { title: '即时通讯', icon: 'dashboard',hidden:false }
  //     }
  //   ]
  // },
  // 即时通讯移动端
  {
    path: '/instantMessaging/phone',
    component: () => import('@/views/instantMessaging/phone'),
    hidden: true
  },
  // 即时通讯客服通讯
  {
    path: '/instantMessaging/tourist',
    component: () => import('@/views/instantMessaging/tourist'),
    hidden: true
  },
  // 智慧驾驶舱大屏
  {
    path: '/investment/track/cockpit',
    component: () => import('@/views/investment/track/cockpit'),
    hidden: true,
    beforeEnter: (to, from, next) => {
      console.log(to, from)
      // 如果目标路由设置了在新页面打开，则通过 JavaScript 打开新页面
      if (!window.localStorage.getItem('cockpitFlag')) {
        window.open(to.fullPath, '_blank')
        next(false)
        window.localStorage.setItem('cockpitFlag', true)
      } else {
        next() // 正常导航
      }
    },
    meta: {
      target: '_blank' // 在新页面打开
    }
  },

]

export const asyncRoutes = []

export const errorRoutes = [
  {
    path: '/404',
    component: () => import('@/framework/views/404'),
    hidden: true
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]
